Design - Concepts and Terminology
General
-
-
Aesthetics and programming theories.
-
Casing
-
camelCase :
-
getCookie
-
-
snake_case :
-
get_cookie
-
-
PascalCase :
-
GetCookie
-
Anonymous Functions vs Lambda Functions vs Closures
-
Lambda :
-
They are Anonymous Functions, even smaller, in one line.
-
-
Closures :
-
An Anonymous Function, but aware of its surroundings.
-
Operators
-
Unary :
-
Operators operate on a single target (such as
-a). Unary prefix operators appear immediately before their target (such as!b), and unary postfix operators appear immediately after their target (such asc!).
-
-
Binary :
-
Operators operate on two targets (such as
2 + 3) and are infix because they appear between their two targets.
-
-
Ternary :
-
Operators operate on three targets. Like C, Swift has only one ternary operator, the ternary conditional operator (
a ? b : c).
-
-
The values that operators affect are operands . In the expression
1 + 2, the+symbol is an infix operator and its two operands are the values1and2.
Compilation / Interpreter
Reflection
-
It is the ability of a program to inspect and manipulate its own structure at runtime.
-
This includes:
-
Listing types, functions, fields, attributes.
-
Getting function argument types.
-
Dynamically creating instances of types.
-
Invoking functions by their names.
-
-
Function Introspection :
-
A subtype of reflection. Refers specifically to the ability to:
-
Get the function name.
-
View its parameters and types.
-
Know its return type.
-
Inspect attributes.
-
View its source code.
-
-
Components
-
Components are modular units of software that encapsulate logic, state, and presentation.
-
They are often used in architectures such as Component-Based Architecture, common in frameworks like React, Vue.js, and Angular.
-
Main characteristics :
-
Encapsulation :
-
A component is an independent entity that can have its own state and internal logic.
-
-
Reusability :
-
It can be used in different parts of the system without code duplication.
-
-
Interoperability :
-
It can interact with other components through properties (props), events, or interfaces.
-
-
Lifecycle :
-
It can have initialization, update, and destruction phases.
-
-
Composition
About
-
Composition is a code structuring technique where objects, functions, or components are built by combining smaller, reusable entities.
-
Composition can occur in different forms, such as:
-
Object Composition :
-
An object contains other objects as attributes.
-
-
Functional Composition :
-
Functions are combined to form processing pipelines.
-
-
Component Composition :
-
A component is composed of smaller components.
-
-
Inheritance vs Composition
-
Inheritance vs Composition, by MetaphoricallySpeaking .
-
I liked the drawer organization example.
-
-
Inheritance vs Composition, by Tutemic .
-
He calls it Component Pattern instead of Composition, but I believe itβs the same thing.
-
-
In Godot
-
Composition in Godot, for defining attacks .
-
{4:55 -> 8:40}
-
He uses the combination of components to define what can happen during the attack.
-
The activation of these components is done via an AnimationPlayer dedicated to the attack.
-
-